#! /bin/bash
export LANG=zh_CN.UTF-8
HIVE_HOME=/usr/bin/hive


${HIVE_HOME} -S -e "
-- 创建edu_dwd
create database if not exists  edu_dwd;
use edu_dwd;
drop table kxh_fact_web_chat_ems;
create table if not exists kxh_fact_web_chat_ems(
    id   int comment '主键',
    session_id                   string   comment '七陌sessionId',
    sid                          string comment '访客id',
    create_time                  string     comment '会话创建时间',
    seo_source                   string comment '搜索来源',
    ip                           string  comment 'IP地址',
    area                         string  comment '地域',
    origin_channel               string   comment '投放渠道',
    msg_count                    int    comment '客户发送消息数'
)
    comment '访问咨询表'
row format delimited
fields terminated by '\t'
stored as orc tblproperties ('orc.compress'='snappy');

drop table kxh_fact_web_chat_text_ems;
create table if not exists kxh_fact_web_chat_text_ems
(
    id                   int   comment '主键',
    from_url             string comment '会话来源页面'
)row format delimited
fields terminated by '\t'
stored as orc tblproperties ('orc.compress'='snappy');
"